<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='系统错误日志'}}
{{assign var="app" value='DebugLog'}}
{{assign var="act" value='index'}}
{{assign var="table" value='debug_log'}}
{{assign var="td" value='8'}}
<title>{{$title}}管理 - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
{{include file="{{$smarty.const.PLUG}}chosen/chosen.html"}}
</head>
<body>

{{include file="include/sidebar.html"}}
<style>
.switch {
	display: inline-block;
    position: relative;
    margin: 0px;
    height: 22px;
    width: 100px;
    background: #393C41;
    border-radius: 3px;
    -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.1);
    vertical-align: middle;
	margin-top: -3px;
}
.switch-input {
    display: none;
}
.switch-label {
    position: relative;
    z-index: 2;
    float: left;
    width: 48px;
    line-height: 22px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}
.switch-label-off {
    padding-left: 2px;
}
.switch-label-on {
    padding-right: 2px;
}
.switch-input:checked + .switch-label {
    font-weight: bold;
    color: rgba(0, 0, 0, 0.65);
    text-shadow: 0 1px rgba(255, 255, 255, 0.25);
    -webkit-transition: 0.15s ease-out;
    -moz-transition: 0.15s ease-out;
    -o-transition: 0.15s ease-out;
    transition: 0.15s ease-out;
}
.switch-selection {
    display: block;
    position: absolute;
    z-index: 1;
    top: 2px;
    left: 2px;
    width: 48px;
    height: 18px;
    border-radius: 3px;
    -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 0 2px rgba(0, 0, 0, 0.2);
    -webkit-transition: left 0.15s ease-out;
    -moz-transition: left 0.15s ease-out;
    -o-transition: left 0.15s ease-out;
    transition: left 0.15s ease-out;
    background: #3d9c46;
}
.switch-input:checked + .switch-label-on ~ .switch-selection {
    left: 50px;
}
</style>

<div class="body_right">
	<div id="content">
	
	<div class="search">
	<form name='search' class="router" action="index.php" method="get">
	<input type="hidden" name="app" value="{{$app}}"/>
	<ul class="bread">
		<li>
			日期：<input type="text" class="Wdate input-small" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="create_time" value="{{$smarty.get.create_time}}"/>
		</li>
		<li>
			<select class="combox" name="app_name">
				<option value="">--选择应用--</option>
				{{html_options options=$apps selected=$smarty.get.app_name}}
			 </select>
		</li>
		<li>
			<button type="submit" class="search btn btn-success"><i class="icon-search"></i>搜索</button>
			<a href="index.php?app={{$app}}" class="a">清除</a>
		</li>
		<li class="floatr">
			是否开启数据库记录：
			<div class="switch">
		      <input type="radio" class="switch-input" name="sql_log" value="1" id="running" {{if $sqlLog}}checked{{/if}}>
		      <label for="running" class="switch-label switch-label-off">开启</label>
		      <input type="radio" class="switch-input" name="sql_log" value="0" id="closing" {{if !$sqlLog}}checked{{/if}}>
		      <label for="closing" class="switch-label switch-label-on">关闭</label>
		      <span class="switch-selection"></span>
		    </div>
		    <script>
				$(function(){
					{{if !$sqlLog}}
					$('.switch-selection').css('background','#bd362f');
					{{/if}}
					
					$('input[name=sql_log]').change(function(){
						$.post('{{"index.php?app=debugLog&act=setSqlLog"|URL}}',{value:$('input[name=sql_log]:checked').val()},function(xml){
							parent.location.reload();
						},'json');
					});
				});
			</script>
			</li>
	</ul>
	</form>
	</div>

	<form name='form' action="index.php?app={{$app}}" method="post">
	<input type="hidden" name="app" value="{{$app}}"/>
	<input type="hidden" name="act" value=""/>
	<input type="hidden" name="table" value="{{$table}}"/>
	<table class="table table-bordered">
		<tr class="thead">
		  <td colspan="{{$td}}">
		  	  <div class="floatr">
				<a class="btn ajaxSubmit refresh" link="index.php?app={{$app}}&act=import"><i class="icon-plus"></i>导入日志</a>
				<a class="btn delete btn-danger" href="javascript:"><i class="icon-trash icon-white"></i>批量删除</a>
			  </div>
		  	  ◆ {{$title}}管理 －> {{$title}}列表
		  </td>
		</tr>
		{{if !$list}}
		<tr class="noline"><td colspan="{{$td}}" class="result_empty"></td></tr>
		{{else}}
		<tr class="ttitle">
			<th width="30"><label><input class="check_all" type="checkbox"/></label></th>
			<th>时间</th>
			<th>级别</th>
			<th>消息</th>
			<th>访问URL</th>
			<th>文件</th>
			<th>行号</th>
			<th>应用</th>
		</tr>
		<tbody>
			{{foreach from=$list item=val key=key}}
			<tr>
				<td><label><input name="check_id[]" class="check_id" value="{{$val.id}}" type="checkbox"/> <input name="ids[]" value="{{$val.id}}" type="hidden"/></label></td>
				<td width="120">{{$val.create_time}}</td>
				<td width="40">{{$val.level_name}}</td>
				<td class="box" style="color:#0000CD">{{$val.msg}}</td>
				<td width="20%" >{{$val.url}}</td>
				<td width="20%" title="{{$list[loop].file}}">{{$val.file_path}}</td>
				<td width="40">{{$val.line_number}}</td>
				<td width="45">{{$val.app_name}}</td>
			</tr>
		    {{/foreach}}
			<!-- <tr class="noline ttitle">
			  <td colspan="{{$td}}">
				<a class="check_all btn"><i class="icon-ok"></i>全选/反选</a>
			  </td>
			</tr> -->
			<tr class="thead">
			  <td colspan="{{$td}}">
				{{include file="include/page.html"}}
			  </td>
			</tr>
		</tbody>
		{{/if}}
	</table>
	</form>
</div>
</div>

</body>
</html>
